1 
2 /******************************************************************************
3  * $Id: shapefil.h,v 1.52 2011-12-11 22:26:46 fwarmerdam Exp $
4  *
5  * Project:  Shapelib
6  * Purpose:  Primary include file for Shapelib.
7  * Author:   Frank Warmerdam, warmerdam@pobox.com
8  *
9  ******************************************************************************
10  * Copyright (c) 1999, Frank Warmerdam
11  *
12  * This software is available under the following "MIT Style" license,
13  * or at the option of the licensee under the LGPL (see LICENSE.LGPL).  This
14  * option is discussed in more detail in shapelib.html.
15  *
16  * --
17  * 
18  * Permission is hereby granted, free of charge, to any person obtaining a
19  * copy of this software and associated documentation files (the "Software"),
20  * to deal in the Software without restriction, including without limitation
21  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
22  * and/or sell copies of the Software, and to permit persons to whom the
23  * Software is furnished to do so, subject to the following conditions:
24  *
25  * The above copyright notice and this permission notice shall be included
26  * in all copies or substantial portions of the Software.
27  *
28  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
29  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
31  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
34  * DEALINGS IN THE SOFTWARE.
35  ******************************************************************************
36  *
37  * $Log: shapefil.h,v $
38  * Revision 1.52  2011-12-11 22:26:46  fwarmerdam
39  * upgrade .qix access code to use SAHooks (gdal #3365)
40  *
41  * Revision 1.51  2011-07-24 05:59:25  fwarmerdam
42  * minimize use of CPLError in favor of SAHooks.Error()
43  *
44  * Revision 1.50  2011-05-13 17:35:17  fwarmerdam
45  * added DBFReorderFields() and DBFAlterFields() functions (from Even)
46  *
47  * Revision 1.49  2011-04-16 14:38:21  fwarmerdam
48  * avoid warnings with gcc on SHP_CVSID
49  *
50  * Revision 1.48  2010-08-27 23:42:52  fwarmerdam
51  * add SHPAPI_CALL attribute in code
52  *
53  * Revision 1.47  2010-01-28 11:34:34  fwarmerdam
54  * handle the shape file length limits more gracefully (#3236)
55  *
56  * Revision 1.46  2008-11-12 14:28:15  fwarmerdam
57  * DBFCreateField() now works on files with records
58  *
59  * Revision 1.45  2008/11/11 17:47:10  fwarmerdam
60  * added DBFDeleteField() function
61  *
62  * Revision 1.44  2008/01/16 20:05:19  bram
63  * Add file hooks that accept UTF-8 encoded filenames on some platforms.  Use SASetupUtf8Hooks
64  *  tosetup the hooks and check SHPAPI_UTF8_HOOKS for its availability.  Currently, this
65  *  is only available on the Windows platform that decodes the UTF-8 filenames to wide
66  *  character strings and feeds them to _wfopen and _wremove.
67  *
68  * Revision 1.43  2008/01/10 16:35:30  fwarmerdam
69  * avoid _ prefix on #defined symbols (bug 1840)
70  *
71  * Revision 1.42  2007/12/18 18:28:14  bram
72  * - create hook for client specific atof (bugzilla ticket 1615)
73  * - check for NULL handle before closing cpCPG file, and close after reading.
74  *
75  * Revision 1.41  2007/12/15 20:25:32  bram
76  * dbfopen.c now reads the Code Page information from the DBF file, and exports
77  * this information as a string through the DBFGetCodePage function.  This is 
78  * either the number from the LDID header field ("LDID/<number>") or as the 
79  * content of an accompanying .CPG file.  When creating a DBF file, the code can
80  * be set using DBFCreateEx.
81  *
82  * Revision 1.40  2007/12/06 07:00:25  fwarmerdam
83  * dbfopen now using SAHooks for fileio
84  *
85  * Revision 1.39  2007/12/04 20:37:56  fwarmerdam
86  * preliminary implementation of hooks api for io and errors
87  *
88  * Revision 1.38  2007/11/21 22:39:56  fwarmerdam
89  * close shx file in readonly mode (GDAL #1956)
90  *
91  * Revision 1.37  2007/10/27 03:31:14  fwarmerdam
92  * limit default depth of tree to 12 levels (gdal ticket #1594)
93  *
94  * Revision 1.36  2007/09/10 23:33:15  fwarmerdam
95  * Upstreamed support for visibility flag in SHPAPI_CALL for the needs
96  * of GDAL (gdal ticket #1810).
97  *
98  * Revision 1.35  2007/09/03 19:48:10  fwarmerdam
99  * move DBFReadAttribute() static dDoubleField into dbfinfo
100  *
101  * Revision 1.34  2006/06/17 15:33:32  fwarmerdam
102  * added pszWorkField - bug 1202 (rso)
103  *
104  * Revision 1.33  2006/02/15 01:14:30  fwarmerdam
105  * added DBFAddNativeFieldType
106  *
107  * Revision 1.32  2006/01/26 15:07:32  fwarmerdam
108  * add bMeasureIsUsed flag from Craig Bruce: Bug 1249
109  *
110  * Revision 1.31  2006/01/05 01:27:27  fwarmerdam
111  * added dbf deletion mark/fetch
112  *
113  * Revision 1.30  2005/01/03 22:30:13  fwarmerdam
114  * added support for saved quadtrees
115  *
116  * Revision 1.29  2004/09/26 20:09:35  fwarmerdam
117  * avoid rcsid warnings
118  *
119  * Revision 1.28  2003/12/29 06:02:18  fwarmerdam
120  * added cpl_error.h option
121  *
122  * Revision 1.27  2003/04/21 18:30:37  warmerda
123  * added header write/update public methods
124  *
125  * Revision 1.26  2002/09/29 00:00:08  warmerda
126  * added FTLogical and logical attribute read/write calls
127  *
128  * Revision 1.25  2002/05/07 13:46:30  warmerda
129  * added DBFWriteAttributeDirectly().
130  *
131  * Revision 1.24  2002/04/10 16:59:54  warmerda
132  * added SHPRewindObject
133  *
134  * Revision 1.23  2002/01/15 14:36:07  warmerda
135  * updated email address
136  *
137  * Revision 1.22  2002/01/15 14:32:00  warmerda
138  * try to improve SHPAPI_CALL docs
139  */
140 
141 module shapefil;
142  
143 import core.stdc.stdio;  //#include <stdio.h>
144 
145 /******************
146  * Presently I am assuming dbmalloc is not used. 
147 #ifdef USE_DBMALLOC
148 #include <dbmalloc.h>
149 #endif
150 */
151 
152 
153 /************************************************************************/
154 /*                        Configuration options.                        */
155 /************************************************************************/
156 
157 /* -------------------------------------------------------------------- */
158 /*      Should the DBFReadStringAttribute() strip leading and           */
159 /*      trailing white space?                                           */
160 /* -------------------------------------------------------------------- */
161 //#define TRIM_DBF_WHITESPACE
162 
163 /* -------------------------------------------------------------------- */
164 /*      Should we write measure values to the Multipatch object?        */
165 /*      Reportedly ArcView crashes if we do write it, so for now it     */
166 /*      is disabled.                                                    */
167 /* -------------------------------------------------------------------- */
168 //#define DISABLE_MULTIPATCH_MEASURE
169     
170 /* -------------------------------------------------------------------- */
171 /*      SHPAPI_CALL                                                     */
172 /*                                                                      */
173 /*      The following two macros are present to allow forcing           */
174 /*      various calling conventions on the Shapelib API.                */
175 /*                                                                      */
176 /*      To force __stdcall conventions (needed to call Shapelib         */
177 /*      from Visual Basic and/or Dephi I believe) the makefile could    */
178 /*      be modified to define:                                          */
179 /*                                                                      */
180 /*        /DSHPAPI_CALL=__stdcall                                       */
181 /*                                                                      */
182 /*      If it is desired to force export of the Shapelib API without    */
183 /*      using the shapelib.def file, use the following definition.      */
184 /*                                                                      */
185 /*        /DSHAPELIB_DLLEXPORT                                          */
186 /*                                                                      */
187 /*      To get both at once it will be necessary to hack this           */
188 /*      include file to define:                                         */
189 /*                                                                      */
190 /*        #define SHPAPI_CALL __declspec(dllexport) __stdcall           */
191 /*        #define SHPAPI_CALL1 __declspec(dllexport) * __stdcall        */
192 /*                                                                      */
193 /*      The complexity of the situtation is partly caused by the        */
194 /*      peculiar requirement of Visual C++ that __stdcall appear        */
195 /*      after any "*"'s in the return value of a function while the     */
196 /*      __declspec(dllexport) must appear before them.                  */
197 /* -------------------------------------------------------------------- */
198 
199 /*
200  * IGNORING 
201 #ifdef SHAPELIB_DLLEXPORT
202 #  define SHPAPI_CALL __declspec(dllexport)
203 #  define SHPAPI_CALL1(x)  __declspec(dllexport) x
204 #endif
205 
206 #ifndef SHPAPI_CALL
207 #  if defined(USE_GCC_VISIBILITY_FLAG)
208 #    define SHPAPI_CALL     __attribute__ ((visibility("default")))
209 #    define SHPAPI_CALL1(x) __attribute__ ((visibility("default")))     x
210 #  else
211 #    define SHPAPI_CALL
212 #  endif
213 #endif
214 
215 #ifndef SHPAPI_CALL1
216 #  define SHPAPI_CALL1(x)      x SHPAPI_CALL
217 #endif
218     */
219     
220     
221 /* -------------------------------------------------------------------- */
222 /*      Macros for controlling CVSID and ensuring they don't appear     */
223 /*      as unreferenced variables resulting in lots of warnings.        */
224 /* -------------------------------------------------------------------- */
225 
226 /******
227 * Hide this for now !!!!
228 
229 #ifndef DISABLE_CVSID
230 #  if defined(__GNUC__) && __GNUC__ >= 4
231 #    define SHP_CVSID(string)     static char cpl_cvsid[] __attribute__((used)) = string;
232 #  else
233 #    define SHP_CVSID(string)     static char cpl_cvsid[] = string; \
234 static char *cvsid_aw() { return( cvsid_aw() ? ((char *) NULL) : cpl_cvsid ); }
235 #  endif
236 #else
237 #  define SHP_CVSID(string)
238 #endif
239 
240 */
241 
242 /* -------------------------------------------------------------------- */
243 /*      On some platforms, additional file IO hooks are defined that    */
244 /*      UTF-8 encoded filenames Unicode filenames                       */
245 /* -------------------------------------------------------------------- */
246 
247 /***
248 
249 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
250 #	define SHPAPI_WINDOWS
251 #	define SHPAPI_UTF8_HOOKS
252 #endif
253 */
254 
255 
256 /* -------------------------------------------------------------------- */
257 /*      IO/Error hook functions.                                        */
258 /* -------------------------------------------------------------------- */
259 alias int* SAFile;
260 
261 alias core.stdc.config.c_ulong SAOffset;
262 
263 struct SAHooks 
264 {
265   extern( C ) SAFile   function( const(char)* filename, const(char)* access) FOpen;
266   extern( C ) SAOffset function( void* p, SAOffset size, SAOffset nmemb, SAFile file ) FRead;
267   extern( C ) SAOffset function( void* p, SAOffset size, SAOffset nmemb, SAFile file ) FWrite;
268   extern( C ) SAOffset function( SAFile file, SAOffset offset, int whence ) FSeek;
269   extern( C ) SAOffset function( SAFile file ) FTell;
270   extern( C ) int      function( SAFile file ) FFlush;
271   extern( C ) int      function( SAFile file ) FClose;
272   extern( C ) int      function( SAFile file ) Remove;
273   extern( C ) void     function( SAFile file ) Error_; //Error is a D keyword
274   extern( C ) double   function( SAFile file ) Atof;
275 }
276 
277 //void SHPAPI_CALL SASetupDefaultHooks( SAHooks *psHooks );
278 //#ifdef SHPAPI_UTF8_HOOKS
279 //void SHPAPI_CALL SASetupUtf8Hooks( SAHooks *psHooks );
280 //#endif
281 extern( C ) void SASetupDefaultHooks( SAHooks *psHooks ) nothrow;
282 extern( C ) void SASetupUtf8Hooks( SAHooks *psHooks ) nothrow;
283 
284 /************************************************************************/
285 /*                             SHP Support.                             */
286 /************************************************************************/
287 struct SHPInfo {
288   SAHooks 	sHooks;
289   SAFile	fpSHP;
290   SAFile	fpSHX;
291   int 		nShapeType;
292   uint 		nFileSize;
293   int   	nRecords;
294   int    	nMaxRecords;
295   uint*		panRecOffset;
296   uint*		panRecSize;
297   double[4]	adBoundsMin;
298   double[4]	adBoundsMax;
299   int  		bUpdated;
300   ubyte		pabyRec;
301   int  		nBufSize;
302 }
303 
304 
305 alias SHPInfo* SHPHandle;
306 
307 
308 /* -------------------------------------------------------------------- */
309 /*      Shape types (nSHPType)                                          */
310 /* -------------------------------------------------------------------- */
311 enum 
312 {
313   SHPT_NULL = 0, 	
314   SHPT_POINT = 1, 	
315   SHPT_ARC = 3, 	
316   SHPT_POLYGON = 5,
317   SHPT_MULTIPOINT = 8,
318   SHPT_POINTZ = 11,
319   SHPT_ARCZ = 13,
320   SHPT_POLYGONZ = 15,
321   SHPT_MULTIPOINTZ = 18,
322   SHPT_POINTM = 21,
323   SHPT_ARCM = 23,
324   SHPT_POLYGONM = 25,
325   SHPT_MULTIPOINTM = 28,
326   SHPT_MULTIPATCH = 31
327 }
328 
329 /* -------------------------------------------------------------------- */
330 /*      Part types - everything but SHPT_MULTIPATCH just uses           */
331 /*      SHPP_RING.                                                      */
332 /* -------------------------------------------------------------------- */
333 enum 
334 {
335   SHPP_TRISTRIP	= 0,	
336   SHPP_TRIFAN = 1,
337   SHPP_OUTERRING = 2,
338   SHPP_INNERRING = 3,
339   SHPP_FIRSTRING = 4,
340   SHPP_RING = 5,
341 }
342 
343 
344 
345 /* -------------------------------------------------------------------- */
346 /*      SHPObject - represents on shape (without attributes) read       */
347 /*      from the .shp file.                                             */
348 /* -------------------------------------------------------------------- */
349 struct SHPObject 
350 {
351     int		nSHPType;
352     int		nShapeId;
353     
354     int		nParts;
355     int		*panPartStart;
356     int		*panPartType;
357     
358     int		nVertices;
359     double	*padfX;
360     double	*padfY;
361     double	*padfZ;
362     double	*padfM;
363 
364     double	dfXMin;
365     double	dfYMin;
366     double	dfZMin;
367     double	dfMMin;
368 
369     double	dfXMax;
370     double	dfYMax;
371     double	dfZMax;
372     double	dfMMax;
373 
374     int		bMeasureIsUsed;
375 }
376 
377 /* -------------------------------------------------------------------- */
378 /*      SHP API Prototypes                                              */
379 /* -------------------------------------------------------------------- */
380 
381 /* If pszAccess is read-only, the fpSHX field of the returned structure */
382 /* will be NULL as it is not necessary to keep the SHX file open */
383 
384 
385 extern( C ) SHPHandle 
386 SHPOpen(const(char)* filename, const(char)* pszAcces) nothrow;
387 
388 
389 extern( C ) SHPHandle 
390 SHPOpenLL( const(char)* pszShapeFile, const(char)* pszAccess, 
391            SAHooks *psHooks ) nothrow;
392                  
393 extern( C ) SHPHandle 
394 SHPCreate( const(char)* pszShapeFile, int nShapeType ) nothrow;      
395   
396 extern( C ) SHPHandle 
397 SHPCreateLL( const(char)* pszShapeFile, int nShapeType,
398              SAHooks *psHooks ) nothrow;
399                    
400 extern( C ) void 
401 SHPGetInfo( SHPHandle hSHP, int* pnEntities, 
402 	    int* pnShapeType, double* padfMinBound, 
403 	    double* padfMaxBound ) nothrow;
404 
405 extern( C ) SHPObject* 
406 SHPReadObject( SHPHandle hSHP, int iShape ) nothrow;     
407       
408 extern( C ) int 
409 SHPWriteObject( SHPHandle hSHP, int iShape, SHPObject* psObject ) nothrow;      
410       
411 extern( C ) void SHPDestroyObject( SHPObject* psObject ) nothrow;
412       
413 extern( C ) void SHPComputeExtents( SHPObject* psObject ) nothrow;
414 
415 extern( C ) SHPObject* 
416 SHPCreateObject( int nSHPType, int nShapeId, int nParts, 
417                  const(int)* panPartStart, const(int)* panPartType,
418                  int nVertices, 
419                  const(double) * padfX, const(double)* padfY,
420                  const(double)* padfZ, const(double)* padfM ) nothrow;
421 
422 extern( C ) SHPObject* 
423 SHPCreateSimpleObject( int nSHPType, int nVertices,
424                        const(double)* padfX, 
425                        const(double)* padfY, 
426                        const(double)* padfZ ) nothrow;
427                              
428 
429 extern( C ) int 
430 SHPRewindObject( SHPHandle hSHP, SHPObject* psObject ) nothrow;
431 
432 extern( C ) void SHPClose( SHPHandle hSHP ) nothrow;
433 
434 extern( C ) void SHPWriteHeader( SHPHandle hSHP ) nothrow;
435 
436 extern( C ) const(char)*  SHPTypeName( int nSHPType ) nothrow;
437 
438 extern( C ) const(char)* SHPPartTypeName( int nPartType ) nothrow;
439 
440 /* -------------------------------------------------------------------- */
441 /*      Shape quadtree indexing API.                                    */
442 /* -------------------------------------------------------------------- */
443 
444 /* this can be two or four for binary or quad tree */
445 enum MAX_SUBNODE = 4;
446 
447 /* upper limit of tree levels for automatic estimation */
448 enum MAX_DEFAULT_TREE_DEPTH = 12;
449 
450 struct SHPTreeNode 
451 {
452   //region covered by this node.
453   double[4]	adBoundsMin;  
454   double[4]	adBoundsMax;
455   
456   /* list of shapes stored at this node.  The papsShapeObj pointers
457    * or the whole list can be NULL */
458   int		nShapeCount;
459   int*          panShapeIds;
460   SHPObject**   papsShapeObj;
461   
462   int		nSubNodes;
463   SHPTreeNode[MAX_SUBNODE]* apsSubNode;  
464 }
465 
466 
467 struct SHPTree 
468 {
469     SHPHandle   hSHP;
470     
471     int		 nMaxDepth;
472     int		 nDimension;
473     int          nTotalCount;
474     
475     SHPTreeNode* psRoot;
476 }
477 
478 
479 extern( C ) SHPTree* 
480 SHPCreateTree( SHPHandle hSHP, int nDimension, int nMaxDepth,
481                double* padfBoundsMin, double* padfBoundsMax ) nothrow;
482                      
483 extern( C ) void SHPDestroyTree( SHPTree* hTree ) nothrow;
484 
485 extern( C ) int SHPWriteTree( SHPTree* hTree, const(char)* pszFilename ) nothrow;
486 
487 extern( C ) int SHPTreeAddShapeId( SHPTree* hTree, SHPObject* psObject ) nothrow;
488 
489 extern( C ) int SHPTreeRemoveShapeId( SHPTree* hTree, int nShapeId ) nothrow;
490 
491 extern( C ) void SHPTreeTrimExtraNodes( SHPTree* hTree )  nothrow;
492 
493 extern( C ) int* 
494 SHPTreeFindLikelyShapes( SHPTree* hTree, double* padfBoundsMin,
495                          double* padfBoundsMax, int* pnShapeCount ) nothrow;
496 
497 extern( C ) int 
498 SHPCheckBoundsOverlap(double* padfBox1Min, double* padfBox1Max,
499 		      double* padfBox2Min, double* padfBox2Max,
500 		      int nDimension ) nothrow;
501 
502 extern( C ) int* SHPSearchDiskTree( FILE* fp, 
503 				    double* padfBoundsMin, double* padfBoundsMax,
504 				    int* pnShapeCount ) nothrow;
505 /*
506  *The struct SHPDiskTreeInfo is defined in shptree.c as follows:
507  *
508  * struct SHPDiskTreeInfo
509  * {
510  *   SAHooks sHooks;
511  *   SAFile  fpQIX;
512  *};
513  * Only this typedef is included in the header shapefil.h, but
514  * I've added here to get things to compile!
515  */
516 struct SHPDiskTreeInfo
517 {
518   SAHooks	sHooks;
519   SAFile	fpQIX;
520 }
521  
522 alias SHPDiskTreeInfo* SHPTreeDiskHandle;
523 
524 extern( C ) SHPTreeDiskHandle 
525 SHPOpenDiskTree( const(char)* pszQIXFilename,
526                  SAHooks* psHooks ) nothrow;
527 
528 
529 extern( C ) void SHPCloseDiskTree( SHPTreeDiskHandle hDiskTree ) nothrow;
530 
531 extern( C ) int* 
532 SHPSearchDiskTreeEx( SHPTreeDiskHandle hDiskTree, 
533                      double* padfBoundsMin, double* padfBoundsMax,
534                      int* pnShapeCount ) nothrow;
535 
536 extern( C ) int 
537 SHPWriteTreeLL(SHPTree* hTree, const char* pszFilename, SAHooks* psHooks ) nothrow;
538 
539 /************************************************************************/
540 /*                             DBF Support.                             */
541 /************************************************************************/
542 struct DBFInfo {
543     SAHooks sHooks;
544     SAFile	fp;
545 
546     int         nRecords;
547     int		nRecordLength;
548     int		nHeaderLength;
549     int		nFields;
550     int*        panFieldOffset;
551     int*        panFieldSize;
552     int*        panFieldDecimals;
553     char*       pachFieldType;
554 
555     char*       pszHeader;
556 
557     int		nCurrentRecord;
558     int		bCurrentRecordModified;
559     char*       pszCurrentRecord;
560 
561     int         nWorkFieldLength;
562     char*       pszWorkField;
563     
564     int		bNoHeader;
565     int		bUpdated;
566 
567     double      dfDoubleField;
568 
569     int         iLanguageDriver;
570     char*       pszCodePage;
571 }
572 
573 alias DBFInfo* DBFHandle;
574 
575 enum DBFFieldType 
576 {
577   FTString,
578   FTInteger,
579   FTDouble,
580   FTLogical,
581   FTInvalid
582 }
583 
584 enum int XBASE_FLDHDR_SZ = 32;
585 
586 extern( C ) DBFHandle 
587 DBFOpen( const(char)* pszDBFFile, const(char)* pszAccess ) nothrow;
588 
589 extern( C ) DBFHandle 
590 DBFOpenLL( const(char)* pszDBFFile, const(char)* pszAccess,
591            SAHooks *psHooks ) nothrow;
592 
593 extern( C ) DBFHandle DBFCreate( const(char)* pszDBFFile ) nothrow;
594 
595 extern( C ) DBFHandle 
596 DBFCreateEx( const(char)* pszDBFFile, const(char)* pszCodePage ) nothrow;
597 
598 extern( C ) DBFHandle 
599 DBFCreateLL( const(char)* pszDBFFile, const(char)* pszCodePage, 
600              SAHooks *psHooks ) nothrow;
601 
602 extern( C ) int	
603 DBFGetFieldCount( DBFHandle psDBF ) nothrow;
604 
605 extern( C ) int	
606 DBFGetRecordCount( DBFHandle psDBF ) nothrow;
607 
608 extern( C ) int	
609 DBFAddField( DBFHandle hDBF, const(char)* pszFieldName,
610              DBFFieldType eType, int nWidth, int nDecimals ) nothrow;
611 
612 extern( C )int 
613 DBFAddNativeFieldType( DBFHandle hDBF, const(char)* pszFieldName,
614                        char chType, int nWidth, int nDecimals ) nothrow;
615 
616 extern( C ) int	DBFDeleteField( DBFHandle hDBF, int iField ) nothrow;
617 
618 extern( C ) int DBFReorderFields( DBFHandle psDBF, int* panMap ) nothrow;
619 
620 extern( C ) int 
621 DBFAlterFieldDefn( DBFHandle psDBF, int iField, const(char)* pszFieldName,
622                    char chType, int nWidth, int nDecimals ) nothrow;
623                                    
624 extern( C ) DBFFieldType 
625 DBFGetFieldInfo( DBFHandle psDBF, int iField, char* pszFieldName, 
626                  int* pnWidth, int* pnDecimals ) nothrow;
627 
628 extern( C ) int 
629 DBFGetFieldIndex(DBFHandle psDBF, const(char)* pszFieldName) nothrow;
630 
631 extern( C ) int 
632 DBFReadIntegerAttribute( DBFHandle hDBF, int iShape, int iField ) nothrow;
633 
634 extern( C ) double 
635 DBFReadDoubleAttribute( DBFHandle hDBF, int iShape, int iField ) nothrow;
636 
637 extern( C ) const(char)* 
638 DBFReadStringAttribute( DBFHandle hDBF, int iShape, int iField ) nothrow;
639 
640 extern( C) const(char)* 
641 DBFReadLogicalAttribute( DBFHandle hDBF, int iShape, int iField ) nothrow;
642 
643 extern( C ) int 
644 DBFIsAttributeNULL( DBFHandle hDBF, int iShape, int iField ) nothrow;
645 
646 extern( C ) int 
647 DBFWriteIntegerAttribute( DBFHandle hDBF, int iShape, int iField, 
648                           int nFieldValue ) nothrow;
649 
650 extern( C ) int 
651 DBFWriteDoubleAttribute( DBFHandle hDBF, int iShape, int iField,
652                          double dFieldValue ) nothrow;
653                                          
654 extern( C ) int 
655 DBFWriteStringAttribute( DBFHandle hDBF, int iShape, int iField,
656                          const(char)* pszFieldValue ) nothrow;
657                                          
658 extern( C ) int 
659 DBFWriteNULLAttribute( DBFHandle hDBF, int iShape, int iField ) nothrow;
660 
661 extern( C ) int 
662 DBFWriteLogicalAttribute( DBFHandle hDBF, int iShape, int iField,
663 			  const(char) lFieldValue) nothrow;
664 			       
665 extern( C ) int 
666 DBFWriteAttributeDirectly(DBFHandle psDBF, int hEntity, int iField,
667                           void* pValue ) nothrow;
668                                
669 extern( C ) const(char)* 
670 DBFReadTuple(DBFHandle psDBF, int hEntity ) nothrow;
671 
672 extern( C ) int 
673 DBFWriteTuple(DBFHandle psDBF, int hEntity, void* pRawTuple ) nothrow;
674 
675 extern( C ) int 
676 DBFIsRecordDeleted( DBFHandle psDBF, int iShape ) nothrow;
677 
678 extern( C ) int 
679 DBFMarkRecordDeleted( DBFHandle psDBF, int iShape, 
680                       int bIsDeleted ) nothrow;
681 
682 extern( C ) DBFHandle 
683 DBFCloneEmpty(DBFHandle psDBF, const(char)* pszFilename ) nothrow;
684  
685 extern( C ) void DBFClose( DBFHandle hDBF ) nothrow;
686 
687 extern( C ) void DBFUpdateHeader( DBFHandle hDBF ) nothrow;
688 
689 extern( C ) char DBFGetNativeFieldType( DBFHandle hDBF, int iField ) nothrow;
690 
691 extern( C ) const(char)* DBFGetCodePage(DBFHandle psDBF ) nothrow;